//
//  HJCancellationCell.m
//  KaiChat
//
//  Created by lx on 2024/1/21.
//

#import "HJCancellationCell.h"

 
@implementation HJCancellationCell {
    UIButton *__weak _iconButton;
    UILabel *__weak _titleLabel;
    UILabel *__weak _bodyLabel;
}


- (void)settingSubView {
 
    
    self.backgroundColor = UIColor.clearColor;
    
    self.selectionStyle = UITableViewCellSelectionStyleNone;

    _iconButton = [UIButton addToView:self.contentView];
    _iconButton.userInteractionEnabled = NO;
    [_iconButton setBackgroundImage:[UIImage imageNamed:@"box_icon"] forState:UIControlStateNormal];
    [_iconButton setBackgroundImage:[UIImage imageNamed:@"box_select_icon"] forState:UIControlStateSelected];
    [_iconButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(leftRightMargin);
        make.top.offset(0);
        make.width.height.offset(16);
    }];
    
    _titleLabel = [UILabel lableWithSuperView:self.contentView font:UIFontMediumMake(14) color:UIColor.tj_333333Color title:nil textAlignment:NSTextAlignmentLeft];
    [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_iconButton.mas_right).offset(8);
        make.centerY.equalTo(_iconButton);
    }];
    
    _bodyLabel = [UILabel lableWithSuperView:self.contentView font:UIFontMake(12) color:UIColor.tj_868391Color title:nil textAlignment:NSTextAlignmentLeft];
    _bodyLabel.numberOfLines = 0;
    [_bodyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_titleLabel);
        make.top.equalTo(_titleLabel.mas_bottom).offset(8);
        make.right.inset(leftRightMargin);
    }];
 
}

- (void)setModel:(HJCellModel *)model {
    _model = model;

    _iconButton.selected = model.isSelect;
    _titleLabel.text = model.text;
    _bodyLabel.text = model.subText;
}


@end

